<B:UIVKKOPF x:Class="WPFExcelReport.TGTTVK04"
                    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
                    xmlns:ucd="clr-namespace:ReflectionStudio.Controls;assembly=ReflectionStudio.Controls"     
                    xmlns:me="clr-namespace:WPFExcelReport" 
                    xmlns:B="clr-namespace:WPFExcelReport;assembly=TVKKOPF"              
                    xmlns:ex="clr-namespace:WPFExcelReport.Controls;assembly=ExControls"  
                    xmlns:KD="clr-namespace:WPFExcelReport;assembly=TKDSTAMM"  
                    xmlns:KA="clr-namespace:WPFExcelReport;assembly=TKDANSP" 
                    xmlns:SD="clr-namespace:WPFExcelReport;assembly=TSDDAT"  
                    xmlns:HR="clr-namespace:WPFExcelReport;assembly=THRSTAMM"  
                    xmlns:VL="clr-namespace:WPFExcelReport;assembly=TVERSART"  
                    xmlns:ZA="clr-namespace:WPFExcelReport;assembly=TZABED"  
                    xmlns:ZB="clr-namespace:WPFExcelReport;assembly=TVKZUAB"   
                    xmlns:DR="clr-namespace:WPFExcelReport;assembly=TDRAUFTR" 
                    xmlns:VKP="clr-namespace:WPFExcelReport;assembly=TVKPOS"   
                    xmlns:VKD="clr-namespace:WPFExcelReport;assembly=TVKADR"   
                    xmlns:TXT="clr-namespace:WPFExcelReport;assembly=TTXTIND"
                    xmlns:KV="clr-namespace:WPFExcelReport;assembly=TKUNDVER" 
                    xmlns:Localization="clr-namespace:Localization;assembly=Localization"
                    FontSize="14"
                    x:Name="TV"
                    Loaded="Window_Loaded"
     >
    <B:UIVKKOPF.Resources>
        <CollectionViewSource  x:Key="vwMaster"/>       <CollectionViewSource  x:Key="vwDetail"/>
        <ucd:Divideby10  x:Key="d10"/>
        <ucd:BoolToVisibilityConverter  x:Key="bv"/>
        <ucd:NOTBoolToVisibilityConverter x:Key="nbv"/>
        <ucd:Divideby100  x:Key="d100"/>
        <ucd:Divideby1000  x:Key="d1000"/>
        <ucd:M2YD x:Key="M2YD"/>
        <ucd:Divideby10000 x:Key="dw"/>
        <ucd:NOTConverter  x:Key="not"/>
        <ucd:GB2312Convert8859P1  x:Key="gb2312"/>
    </B:UIVKKOPF.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"></RowDefinition>
            <RowDefinition Height="Auto"></RowDefinition>
            <RowDefinition Height="Auto"></RowDefinition>
            <RowDefinition Height="Auto"></RowDefinition>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="1*"></ColumnDefinition>
            <ColumnDefinition Width="1*"></ColumnDefinition>
        </Grid.ColumnDefinitions>
        <WrapPanel Grid.Row="0"  Grid.Column="0" Grid.ColumnSpan="2" Margin="0,0,0,0"  VerticalAlignment="Bottom"   >
            <WrapPanel  Visibility="{Binding IsEdit,ElementName=TV,Converter={StaticResource nbv}}" >
                <TextBlock Text="{Binding VB,ElementName=TV}"  Foreground="Green"/>
                <KV:TSVB 
                    KUNDNR="00000000"
                    KEY="{Binding VB,ElementName=TV}"/>

                <Grid Margin="10,0,0,0"  VerticalAlignment="Top" 
                  IsEnabled="{Binding IsCanNew,ElementName=TV}">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <Button Grid.Column="0"  Click="NewCommand" Height="20" Margin="5,0,0,0" 
                        VerticalAlignment="Top" Width="24">
                        <Button.Background>
                            <ImageBrush  ImageSource="/ImagePackage;component/Images/Add.png" />
                        </Button.Background>
                    </Button>
                </Grid>
                <Grid Margin="10,0,0,0" VerticalAlignment="Top">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <Button  Click="EditCommand"  
                         IsEnabled="{Binding IsCanChg,ElementName=TV}"
                         Width="24" Height="20">
                        <Button.Background>
                            <ImageBrush  ImageSource="/ImagePackage;component/Images/Edit.png" />
                        </Button.Background>
                    </Button>
                </Grid>
                <Grid Margin="10,0,0,0" VerticalAlignment="Top" Visibility="{Binding IsMaster,Converter={StaticResource bv}}" >
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <Button  Grid.Column="0"   Click="ManageCommand" Width="12" Height="20" VerticalAlignment="Top" 
                          >
                        <Button.Background>
                            <ImageBrush  ImageSource="/ImagePackage;component/Images/Extend.png" />
                        </Button.Background>
                    </Button>
                </Grid>
                <Grid Margin="10,0,0,0"  VerticalAlignment="Top" 
                      IsEnabled="{Binding IsCanDelete,ElementName=TV}">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <Button Click="DeleteCommand" Height="20" Margin="5,0,0,0" Width="24" VerticalAlignment="Top">
                        <Button.Background>
                            <ImageBrush  ImageSource="/ImagePackage;component/Images/Remove.png" />
                        </Button.Background>
                    </Button>
                </Grid>
                <Grid Margin="10,0,0,0"  
                  IsEnabled="{Binding IsCanCopy,ElementName=TV}"  
                  VerticalAlignment="Top">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <Button    Click="CopyCommand" Height="20" Margin="5,0,0,0" Width="24"  VerticalAlignment="Top">
                        <Button.Background>
                            <ImageBrush  ImageSource="/ImagePackage;component/Images/copy.png" />
                        </Button.Background>
                    </Button>
                </Grid>
                <Grid Margin="10,0,0,0" VerticalAlignment="Top" IsEnabled="{Binding IsCanInactive,ElementName=TV}" >
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <Button Click="InactiveCommand" Height="20" Margin="5,0,0,0" Width="24" >
                        <Button.Background>
                            <ImageBrush  ImageSource="/ImagePackage;component/Images/split.png" />
                        </Button.Background>
                    </Button>
                </Grid> 
                <Button Width="Auto" Margin="10,0,0,0" VerticalAlignment="Top" 
                        Content="{Binding Source={Localization:Translate Word=完成销售单}}" Click="VKKConfonfirm"                          
                        IsEnabled="{Binding IsAUFConfirmed,ElementName=TV,Converter={StaticResource not}}"/>
                <Button Width="Auto" Margin="10,0,0,0" VerticalAlignment="Top" 
                        Content="{Binding Source={Localization:Translate Word=发票}}" Click="VRManagement"  />
                <VKD:VKKAD03  Margin="10,0,0,0" 
                                  IsAuto="True" 
                                  VerticalAlignment="Top"
                                  ORDERNUM="{Binding AUF,ElementName=TV}"  
                                  IsEdit="True"   
                             />
                <Grid Margin="10,0,0,0" VerticalAlignment="Top">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <DR:TDRAUFTR  Grid.Column="0" Name="cDR" DocType="{Binding PRTYPE,ElementName=TV}" 
                                  Visibility="Collapsed" PrintType="OpenExcel" />
                    <Button  Grid.Column="1"   Click="btnPrint_Click" Height="20" Margin="5,0,0,0" 
                             Width="Auto" 
                             Content="{Binding Source={Localization:Translate Word=打印购销合同}}" />
                </Grid>
                <Grid Margin="10,0,0,0"  VerticalAlignment="Top" >
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <Button Grid.Column="0"  Click="LinkedOrderCommand" Height="20" Margin="5,0,0,0" Width="24" >
                        <Button.Background>
                            <ImageBrush  ImageSource="/ImagePackage;component/Images/link.png" />
                        </Button.Background>
                    </Button>
                    <TextBlock Grid.Column="2" FontSize="16" Text="{Binding Source={Localization:Translate Word=管理采购}}"/>
                </Grid>
                <WrapPanel>
                    <TextBlock  Text="{Binding Source={Localization:Translate Word=发票:}}"  Margin="10,0,0,0" VerticalAlignment="Top"></TextBlock>
                    <CheckBox IsChecked="{Binding IsShowRight,ElementName=TV,Mode=OneWayToSource}"  
                          VerticalAlignment="Top"></CheckBox>
                </WrapPanel>
                <WrapPanel>
                    <Grid Margin="10,0,0,0" VerticalAlignment="Top"  >
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto"></ColumnDefinition>
                            <ColumnDefinition Width="Auto"></ColumnDefinition>
                            <ColumnDefinition Width="Auto"></ColumnDefinition>
                        </Grid.ColumnDefinitions>
                        <TextBlock Grid.Column="0" FontSize="16"  Text="{Binding Source={Localization:Translate Word=订单号:}}"/>
                        <ex:TXT72 Grid.Column="1" FontSize="16" MaxLength="2" PRE="  "   IsAutoClear="True" CharacterCasing="Upper" 
                              Text="{Binding KRS,ElementName=TV}" Width="30" />
                        <ex:TXT72 Grid.Column="2" FontSize="16" Margin="5,0,0,0" MaxLength="6"  IsAutoClear="True" PRE="000000" 
                              Text="{Binding LFD,ElementName=TV}" KeyUp="AUF_Enter" Width="90" />
                    </Grid>
                    <Button   Click="QueryCommand" Height="20" Margin="5,0,0,0" Width="24" >
                        <Button.Background>
                            <ImageBrush  ImageSource="/ImagePackage;component/Images/Search.png" />
                        </Button.Background>
                    </Button>
                    <TextBlock  FontSize="16" Text="{Binding Source={Localization:Translate Word=查询}}" />
                    
                    <Expander  IsExpanded="False" ExpandDirection="Right" Visibility="Collapsed">
                        <TextBlock  FontSize="16" Text="{Binding ScopeManage,ElementName=TV}" />
                    </Expander>
                </WrapPanel>
                <Grid Margin="10,0,0,0"  VerticalAlignment="Top" 
                  Visibility="{Binding IsVV,Converter={StaticResource bv}}" >
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <TextBlock Grid.Column="0" FontSize="16"  >发货单:</TextBlock>
                    <ex:TXT72 MaxLength="8" PRE="00000000" Grid.Column="1"  FontSize="18" 
                              Text="{Binding LIEFSCH,ElementName=TV}" Width="120"/>
                </Grid>                
            </WrapPanel>
            <Grid Margin="10,0,0,0"     
                  HorizontalAlignment="Center"
                  Visibility="{Binding IsEdit,ElementName=TV,Converter={StaticResource bv}}" 
                  VerticalAlignment="Top">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto"></ColumnDefinition>
                    <ColumnDefinition Width="Auto"></ColumnDefinition>
                </Grid.ColumnDefinitions>
                <Button   Click="SaveCommand" Height="20" Margin="5,0,0,0" Width="24"  VerticalAlignment="Top">
                    <Button.Background>
                        <ImageBrush  ImageSource="/ImagePackage;component/Images/Save.png" />
                    </Button.Background>
                </Button>
            </Grid>

        </WrapPanel>
        <StackPanel Grid.Row="1"  Grid.Column="0" Grid.ColumnSpan="2"
                    Visibility="{Binding IsNew,ElementName=TV,Converter={StaticResource bv}}">
            
            <WrapPanel>
                <TextBlock Text="{Binding VB,ElementName=TV}"  Foreground="Green"/>
                <ex:TXT72 Grid.Column="1" FontSize="16" MaxLength="2" PRE="  "  
                                   CharacterCasing="Upper" 
                                  Text="{Binding KRS,ElementName=TV}" Width="30"/>
                <Grid Margin="10,0,0,0" VerticalAlignment="Top" >
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <TextBlock FontSize="16"  Text="{Binding Source={Localization:Translate Word=类型}}"/> 
                    <SD:K8884  Grid.Column="2"
                               Name="cSD8884"
                                Width="100"
                                 IsEdit="True"
                                 KEY="{Binding AUFART,ElementName=TV}"
                                 EXAUF="{Binding AUFART,ElementName=TV }"/>

                </Grid>
                <Grid Margin="10,0,0,0" VerticalAlignment="Top" >
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <TextBlock FontSize="16"  Text="{Binding Source={Localization:Translate Word=币种}}"/>
                    <SD:TSSD0149 Grid.Column="1" 
                                 Name="cSD0149"
                                     IsEdit="{Binding IsEdit,ElementName=TV}"
                                     KEY="{Binding VKKHWAEHRSL,ElementName=TV}" MinWidth="60"
                                     VALUE="{Binding KURS,ElementName=TV}"
                                 EXAUF="{Binding VKKHWAEHRSL,ElementName=TV}"
                        />
                </Grid>
                <Grid Margin="10,0,0,0" VerticalAlignment="Top">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <TextBlock   Grid.Column="0" FontSize="16"  Text="{Binding Source={Localization:Translate Word=负责人:}}"/>
                    <HR:TSHR20 Grid.Column="1" Name="cSHR20"
                                   IsEdit="True"
                                  BENID="{Binding Path=SACHBE,ElementName=TV}" 
                                  />
                </Grid>
                <Grid Margin="10,0,0,0" VerticalAlignment="Top">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <TextBlock   Grid.Column="0" Text="{Binding Source={Localization:Translate Word=付款方式:}}"/>
                    <ZA:TSZA02 Grid.Column="1" 
                                IsEdit="True" 
                               KEY="{Binding VKZAHLBED,ElementName=TV}"  />
                </Grid>
                <WrapPanel Visibility="{Binding IsCheckKD,ElementName=TV,Converter={StaticResource bv}}" >
                    <KD:TSKD02 Grid.Column="0" MinWidth="100"  IsEdit="{Binding IsEdit,ElementName=TV}"  
                               Name="cKD02"
                               KEY="{Binding Path=KUNDNR,ElementName=TV}" />
                    <Button   Click="NewCommand" Height="20" Margin="5,0,0,0" Width="24" >
                        <Button.Background>
                            <ImageBrush  ImageSource="/ImagePackage;component/Images/button_ok.png" />
                        </Button.Background>
                    </Button>
                </WrapPanel>
                <CheckBox Grid.Column="6" Content="{Binding Source={Localization:Translate Word=检查客户}}"
                          IsChecked="{Binding IsCheckKD,ElementName=TV}"/>            
                <WrapPanel  Visibility="{Binding IsCheckKD,ElementName=TV,Converter={StaticResource nbv}}" >
                    <KD:TNOKD  KEY="{Binding Path=KUNDNR,ElementName=TV}" 
                                           IsNew="{Binding IsCheckKD,ElementName=TV,Converter={StaticResource not}}"/>
                    <Button   Click="NewCommand" Height="20" Margin="5,0,0,0" Width="24" >
                        <Button.Background>
                            <ImageBrush  ImageSource="/ImagePackage;component/Images/button_ok.png" />
                        </Button.Background>
                    </Button>
                </WrapPanel>
            </WrapPanel>
        </StackPanel>  
        <me:USJHVK04 Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2" 
              IsEnabled="{Binding IsInactive,ElementName=TV,Converter={StaticResource not}}"
                     AUFART="{Binding AUFART,ElementName=TV}"
                     VG="{Binding VG,ElementName=TV}"
                     LIEFBED="{Binding LIEFBED,ElementName=TV}"
                     KUNDNR="{Binding KUNDNR,ElementName=TV}"
                     VKKANSPRECH="{Binding VKKANSPRECH,ElementName=TV}" 
                     ZAHLBED="{Binding ZAHLBED,ElementName=TV}"
                     KDSTA="{Binding KDSTA,ElementName=TV}"
                     VSPED="{Binding VSPED,ElementName=TV}"
                       IsKG="{Binding IsKG,ElementName=TV}"
                     KURS="{Binding KURS,ElementName=TV}" 
                     INFO="{Binding INFO,ElementName=TV}"  
            />
    </Grid>
</B:UIVKKOPF>
